Skip to content

Frame window function - #2566

Merged
norberttech merged 2 commits into
1.xfrom
frame-window-function
Jul 29, 2026
Merged

Frame window function#2566
norberttech merged 2 commits into
1.xfrom
frame-window-function

Conversation

@norberttech

Copy link
Copy Markdown
Member

Resolves: #1974

Change Log


Added

  • flow-php/etl - window frames via rowsBetween() with unbounded_preceding(), preceding(), current_row(), following() and unbounded_following()
  • flow-php/etl - count() over a window without a reference counts every row in the frame
  • flow-php/etl - rank() and dense_rank() accept multiple orderBy() columns
  • flow-php/etl - FrameAccumulating and PartitionRanking contracts for incremental window evaluation

Fixed

  • flow-php/etl - rank() and dense_rank() ignored the orderBy() direction
  • flow-php/etl - row_number() gave duplicated rows the same number

Changed

  • flow-php/etl - window aggregates over an ordered window use the SQL default frame instead of the whole partition
  • flow-php/etl - count() over a window counts non-null values in the frame
  • flow-php/etl - partitionBy() no longer sets orderBy()
  • flow-php/etl - WindowFunction::apply() receives a WindowContext
  • flow-php/etl - WindowFunction::over() returns static
  • flow-php/etl - window functions evaluate once per partition instead of once per row, up to 29x faster

Removed

Deprecated

Security

- frame value objects: ROWS, peer and whole-partition, built by DSL
bounds
- SQL-compliant default frame, peer-aware when ordered (BC break)
- WindowFunction::apply() takes a WindowContext with a lazily sliced
frame
- count() over a window means SQL COUNT, not rows sharing a value
- partitionBy() no longer overwrites orderBy(); row_number() fixed on
duplicate rows
- sort each partition once and hoist loop invariants out of aggregate
paths
- replace expectation-less mocks with stubs across test suites
- add FrameAccumulating contract, aggregate growing frames incrementally
- add PartitionRanking contract, rank in one pass per partition
- fix rank/dense_rank ignoring ORDER BY direction
- support multiple ORDER BY columns in rank/dense_rank
- resolve entry reference once in Entries::find()
- narrow WindowFunction::over() return type to static
@norberttech norberttech added this to the 0.43.0 milestone Jul 29, 2026
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.50%. Comparing base (7357bce) to head (1c9433c).
⚠️ Report is 10 commits behind head on 1.x.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##                1.x    #2566      +/-   ##
============================================
+ Coverage     86.43%   86.50%   +0.07%     
- Complexity    23303    23569     +266     
============================================
  Files          1803     1812       +9     
  Lines         71434    71546     +112     
============================================
+ Hits          61747    61894     +147     
+ Misses         9687     9652      -35     
Components Coverage Δ
etl 90.80% <100.00%> (+0.36%) ⬆️
cli 89.40% <ø> (ø)
lib-array-dot 81.44% <ø> (ø)
lib-azure-sdk 64.44% <ø> (ø)
lib-doctrine-dbal-bulk 93.61% <ø> (ø)
lib-filesystem 86.64% <ø> (ø)
lib-types 91.58% <ø> (ø)
lib-parquet 70.23% <ø> (ø)
lib-parquet-viewer 82.26% <ø> (ø)
lib-snappy 89.38% <ø> (ø)
lib-dremel 0.00% <ø> (ø)
lib-postgresql 88.63% <ø> (ø)
lib-telemetry 86.58% <ø> (ø)
bridge-filesystem-async-aws 92.74% <ø> (ø)
bridge-filesystem-azure 90.45% <ø> (ø)
bridge-monolog-http 96.82% <ø> (ø)
bridge-monolog-telemetry 94.79% <ø> (ø)
bridge-openapi-specification 92.07% <ø> (ø)
symfony-http-foundation 78.57% <ø> (ø)
bridge-psr18-telemetry 100.00% <ø> (ø)
bridge-psr3-telemetry 98.95% <ø> (ø)
bridge-psr7-telemetry 100.00% <ø> (ø)
bridge-telemetry-otlp 90.11% <ø> (ø)
bridge-symfony-http-foundation-telemetry 92.85% <ø> (ø)
bridge-symfony-filesystem-bundle 91.85% <ø> (ø)
bridge-symfony-filesystem-cache 98.18% <ø> (ø)
bridge-symfony-postgresql-bundle 93.70% <ø> (ø)
bridge-symfony-postgresql-cache 94.41% <ø> (ø)
bridge-symfony-postgresql-messenger 98.80% <ø> (ø)
bridge-symfony-postgresql-session 93.65% <ø> (ø)
bridge-symfony-telemetry-bundle 90.24% <ø> (ø)
adapter-chartjs 84.05% <ø> (ø)
adapter-csv 89.46% <ø> (ø)
adapter-doctrine 90.75% <ø> (ø)
adapter-google-sheet 91.56% <ø> (ø)
adapter-http 75.79% <ø> (ø)
adapter-json 87.66% <ø> (ø)
adapter-logger 50.00% <ø> (ø)
adapter-parquet 88.69% <ø> (ø)
adapter-text 92.59% <ø> (ø)
adapter-xml 84.27% <ø> (ø)
adapter-avro 0.00% <ø> (ø)
adapter-excel 87.20% <ø> (ø)
adapter-postgresql 90.84% <ø> (ø)
adapter-seal 83.26% <ø> (ø)
bridge-phpunit-postgresql 75.30% <ø> (ø)
bridge-phpunit-telemetry 87.36% <ø> (ø)
bridge-phpstan-types 0.00% <ø> (ø)
bridge-postgresql-valinor 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@norberttech
norberttech merged commit 0900098 into 1.x Jul 29, 2026
49 checks passed
@norberttech
norberttech deleted the frame-window-function branch July 29, 2026 13:27
@github-project-automation github-project-automation Bot moved this from Todo to Done in Roadmap Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Task]: Implement Frame for Window Functions

1 participant